public class MyThread implements Runnable{
    @Override
    public void run() {
        System.out.println("hello thread");
    }

    public static void main(String[] args) {
        Runnable t2 = new MyThread();
        Thread t22 = new Thread(t2);
        t22.start();

        //匿名内部类继承 Thread  重写 run
        Thread t3 = new Thread() {
            @Override
            public void run() {
                System.out.println("hello thread");
            }
        };

        //匿名内部类实现 Runnable，重写run
        Thread t4 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("hello thread");
            }
        });
        t4.start();


    }
}
